/**
 * Created by Freeman on 2016/6/27.
 */


import {UserResource,AuthResource,TagResource,ArticleResource,CommentResource,SearchResource} from './resources'
export default{
    localLogin:function (data) {
        return AuthResource.save({id:'local'},data)
    },
    getMe:function () {
        return UserResource.get({id:'me'})
    },
    mdUser: function (data) {
        return UserResource.update({id:'mdUser'},data)
    },
    register:function (data) {
        return UserResource.save({id:'addUser'},data)
    },
    getTagList:function () {
        return TagResource.get({id:'getFrontTags'})
    },
    addNewArticle:function (data) {
        return ArticleResource.save({id:'saveArticle'},data)
    },
    getArticleList:function (options) {
        return ArticleResource.get({id:'getFrontArticleList',...options})
    },
    getFrontArticle:function (id) {
        return ArticleResource.get({id: id, controller: 'getFrontArticle'})
    },
    toggleLike:function (id) {
        return ArticleResource.update({id:id,controller:'toggleLike'},{})
    },
    getFrontCommentList:function (id) {
        return CommentResource.get({id:id,controller: 'getFrontCommentList'})
    },
    addNewComment:function (data) {
        return CommentResource.save({id:'addNewComment'},data)
    },
    addNewReply:function (id,data) {
        return CommentResource.save({id:id,controller:'addNewReply'},data)
    },
    search:function (data) {
        return SearchResource.get(data)
    },
    deleteArticle:function (id) {
        return ArticleResource.remove({id:id,controller:'deleteArticle'},{})
    }

}